<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class Stamps extends Model
{
    //
    protected $table = 'stamps';
    protected static $baseImg = 'https://winesh.oss-cn-beijing.aliyuncs.com/';

    public function getCoverImgAttribute($val)
    {
        return self::$baseImg . $val;
    }

    public function setPicsAttribute($pictures)
    {
        if (is_array($pictures)) {
            $this->attributes['pics'] = json_encode($pictures);
        }
    }

    public function getPicsAttribute($pictures)
    {
        return json_decode($pictures, true);
    }
}
